<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="/WEB-INF/jsp/include/head.jsp"/>
    <link href="static/plugin/markitup/sets/default/style.css" rel="stylesheet">
    <link href="static/plugin/markitup/skins/markitup/style.css" rel="stylesheet">

</head>
<body>

<!-- 面包屑导航 -->
<ul class="breadcrumb">
    <li><strong>当前位置： </strong>基础设置</li>
    <li class="active">请假事由</li>
</ul>


<div  id="toolbar">
<button id="btn_deleteMonthAgo" style="margin-left: 5px" type="button" class="btn btn-default"><span
        class="glyphicon glyphicon-remove"></span>&nbsp;批量删除
</button>
</div>

<table id="table_data"></table>

<div class="modal fade" id="modal_ajax">
    <div class="modal-dialog ">
        <div class="modal-content ">
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<jsp:include page="/WEB-INF/jsp/include/footer.jsp"/>
<script src="static/plugin/markitup/jquery.markitup.js"></script>

<script>
        var $table = $('#table_data');
        $table.bootstrapTable({
            url: 'log/log4jLog/select',
            striped: true,
            cache: false,
            showRefresh: true,
            searchOnEnterKey: false,
            search: true,
            toolbar: "#toolbar",
            toolbarAlign: 'right',
            pagination: false,
            queryParams: function (params) {
                return params
            },
            columns: [
                {
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                }, {
                    field: 'name',
                    title: '名称',
                    events: 'events',
                    formatter: function (value, row, index) {
                        return [
//                            '<a  class="nameClick" href="javascript:;" style="text-decoration: none ;">' + value + '</a>'
                            '<a   href="log/log4jLog/editDlg?fileName='+row.name+'" style="text-decoration: none ;">' + value + '</a>'
                        ].join('');
                    }
                },
                {
                    title: '操作',
                    events: 'events',
                    formatter: function (value, row, index) {
                        return [
                            '<div class="btn-group btn-group-xs" role="group" >'+

                            '<a  class="btn  btn-xs  btn-default"  role="button" href="business/managerAssess/doc/' + row.id + '">' +
                            '<span class="glyphicon glyphicon-download-alt"></span> 下载</a>'

                            +'<button type="button" class="btn btn-xs btn-default delete_data">' +
                            '<span class="glyphicon glyphicon-remove"></span> 删除' +
                            '</button>'
                            +'</div>'
                        ].join('');
                    }
                }
            ]
        });
        window.events = {
            'click .nameClick': function (e, value, row, index) {
                $('#modal_ajax').modal({
                    backdrop: 'static',
                    keyboard: false,
                    show: true,
                    remote: 'log/log4jLog/editDlg?fileName='+row.name
                });
            },
            'click .delete_data': function (e, value, row, index) {
                $.sysPlugin.superAjax({
                    data: {"fileName":row.name},
                    url: 'log/log4jLog/delete',
                    operateType: 'delete',
                    showSuccessAlert: true,
                    showWarnAlert: true,
                    successCall: function (data) {
                        $.sysPlugin.successCallBack(data, {
                            table: $("#table_data")
                        })
                    }
                })
            },
            'click .downLoad_data': function (e, value, row, index) {
                $.sysPlugin.superAjax({
                    data: {"fileName":row.name},
                    url: 'log/log4jLog/delete',
                    operateType: 'delete',
                    showSuccessAlert: true,
                    showWarnAlert: true,
                    successCall: function (data) {
                        $.sysPlugin.successCallBack(data, {
                            table: $("#table_data")
                        })
                    }
                })
            }
        };
        $("#btn_deleteMonthAgo").click(function () {
            $.sysPlugin.superAjax({
                url: 'log/log4jLog/deleteMonthAgo',
                operateType: 'delete',
                showSuccessAlert: true,
                warnTitle:'确定删除30天以前的所有日志？',
                showWarnAlert: true,
                successCall: function (data) {
                    $.sysPlugin.successCallBack(data, {
                        table: $("#table_data")
                    })
                }
            })
        });

        $.sysPlugin.clearModalRemoveData("modal_ajax");
</script>


</body>
</html>